!function (e, t) {
    e.WxLogin = function (o) {
        var r = "default";
        !0 === o.self_redirect ? r = "true" : !1 === o.self_redirect && (r = "false");
        var n = t.createElement("iframe"),
            s = "https://open.weixin.qq.com/connect/qrconnect?appid=" + o.appid + "&scope=" + o.scope + "&redirect_uri=" + o.redirect_uri + "&state=" + o.state + "&login_type=jssdk&self_redirect=" + r + "&styletype=" + (o.styletype || "") + "&sizetype=" + (o.sizetype || "") + "&bgcolor=" + (o.bgcolor || "") + "&rst=" + (o.rst || "");
        s += o.style ? "&style=" + o.style : "", s += o.href ? "&href=" + o.href : "", s += "en" === o.lang ? "&lang=en" : "", s += 1 === o.stylelite ? "&stylelite=1" : "", s += 0 === o.fast_login ? "&fast_login=0" : "", "auto" === o.color_scheme ? s += "&color_scheme=auto" : "dark" === o.color_scheme ? s += "&color_scheme=dark" : "light" === o.color_scheme && (s += "&color_scheme=light"), n.src = s, n.frameBorder = "0", n.allowTransparency = "true", n.scrolling = "no", n.width = "300px", n.height = "400px";
        var i = t.getElementById(o.id);
        if (i.innerHTML = "", i.appendChild(n), e.addEventListener && e.JSON && o.onReady && "function" == typeof o.onReady) {
            var a = function (t) {
                if ("https://open.weixin.qq.com" === t.origin) try {
                    var r = JSON.parse(t.data);
                    if (r && "status" === r.type) {
                        var n = "wxReady" === r.status;
                        n && o.onReady(n)
                    }
                } catch (t) {
                    e.console && "function" == typeof e.console.log && e.console.log("wxLogin postMessage error", t)
                }
            };
            e.addEventListener("message", a, !1);
            var c = !1;
            o.onCleanup = function () {
                !c && e.removeEventListener && (e.removeEventListener("message", a, !1), c = !0)
            }
        }
    }
}(window, document);